package com.myhome.config;

import cn.hutool.core.lang.Snowflake;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author QYiXin
 * @Date 2021 11 06 21 17
 **/
@Configuration
public class SnowFlakeConfig {
    @Value("${appId:1}")
    private Integer appId;
    @Value("${dataId:2}")
    private Integer dataId;

    @Bean
    public Snowflake getSnowFlake(){
        return new Snowflake(this.appId, this.dataId);
    }
}
